Basic analysis of Vancouver weather patterns:
Data is collected from Govt of Canada website:
(process is automated in ‘van-weather-import.R’)
## [1] "Winter" "Spring" "Summer" "Fall"
Earliest date: 1998-01-01
Most recent date: 2019-07-26
Check data structure:
## Classes 'spec_tbl_df', 'tbl_df', 'tbl' and 'data.frame': 7874 obs. of 10 variables:
## $ Month : Factor w/ 12 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Season : Factor w/ 4 levels "Winter","Spring",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Season.Yr : num 1998 1998 1998 1998 1998 ...
## $ Date : Date, format: "1998-01-01" "1998-01-02" ...
## $ Year : Factor w/ 22 levels "1998","1999",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Day : num 1 2 3 4 5 6 7 8 9 10 ...
## $ Max.Temp : num 8.7 4.2 1.7 2.8 5.7 7 7.3 7.9 4 3.4 ...
## $ Min.Temp : num 3 -1.1 -2.2 -0.9 2.3 3.6 4 1.3 0.3 -1.7 ...
## $ Mean.Temp : num 5.9 1.6 -0.3 1 4 5.3 5.7 4.6 2.2 0.9 ...
## $ Total.Precip: num 5.6 0.6 0.2 6 6.2 3.8 0 0 0 0.2 ...
## - attr(*, "spec")=
## .. cols(
## .. Month = col_double(),
## .. Season = col_character(),
## .. Season.Yr = col_double(),
## .. Date = col_date(format = ""),
## .. Year = col_double(),
## .. Day = col_double(),
## .. Max.Temp = col_double(),
## .. Min.Temp = col_double(),
## .. Mean.Temp = col_double(),
## .. Total.Precip = col_double()
## .. )
Earliest date: 1998-01-01
Most recent date: 2019-07-26
Check Data Relationships
For each month, what has been the pattern in precipitation over the years?
Note: the year for a winter season is applied to year at end of season. So winter from Dec 2018 to Feb 2019 is considered winter of 2019.
##
## Call:
## lm(formula = mean.mean ~ ynum, data = vw.temp.yr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.50567 -0.22162 -0.09896 0.50017 1.26771
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.060969 53.358353 0.114 0.911
## ynum 0.002595 0.026566 0.098 0.923
##
## Residual standard error: 0.7905 on 20 degrees of freedom
## Multiple R-squared: 0.0004769, Adjusted R-squared: -0.0495
## F-statistic: 0.009542 on 1 and 20 DF, p-value: 0.9232
Model interpretation:
Linear modelling for max and min
##
## Call:
## lm(formula = mean.max ~ ynum, data = vw.temp.yr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.99876 -0.22113 0.00135 0.50616 1.41281
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.963644 60.774591 -0.082 0.936
## ynum 0.009613 0.030259 0.318 0.754
##
## Residual standard error: 0.9004 on 20 degrees of freedom
## Multiple R-squared: 0.005021, Adjusted R-squared: -0.04473
## F-statistic: 0.1009 on 1 and 20 DF, p-value: 0.754
Model interpretation:
##
## Call:
## lm(formula = mean.min ~ ynum, data = vw.temp.yr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.00544 -0.30495 -0.08373 0.43447 1.07114
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.574971 47.612167 0.243 0.810
## ynum -0.001706 0.023705 -0.072 0.943
##
## Residual standard error: 0.7054 on 20 degrees of freedom
## Multiple R-squared: 0.0002589, Adjusted R-squared: -0.04973
## F-statistic: 0.00518 on 1 and 20 DF, p-value: 0.9433
Model interpretation:
For each month, what has been the pattern in ave. temperature over the years?
Note: the year for a winter season is applied to year at end of season. So winter from Dec 2018 to Feb 2019 is considered winter of 2019.